const attr = {
	bgc: 'background-color',
	c: 'color'
}

const Re = /(bgc|c)([abcdef\d]{3,6})/g

const color = (str)=>{
	let arrClass = str.match(Re)
	if (arrClass === null) return ''
	return arrClass.join('\n').replace(Re, (cn,suf,val)=>`.${cn}{${attr[suf]}: #${val}}`)
}

module.exports = color